var ec_right2 = echarts.init(document.getElementById("r2"), "dark")

$.get('http://localhost:8080/player/list', function (data) {
    var names = []
    var nums = []
    var nums2 = []
    for (var i = 0; i < data.length; i++) {
        names.push(data[i].player);
        nums.push(data[i].hitRate);
        nums2.push(data[i].threeRate);
    }

    // 基于准备好的dom，初始化echarts实例
    ec_right2.setOption({
        title: {
            text: '球员命中率'
        },
        tooltip: {
            trigger: 'axis'
        },
        legend: {
            data: ['Step Start', 'Step Middle', 'Step End']
        },
        grid: {
            left: '3%',
            right: '4%',
            bottom: '3%',
            containLabel: true
        },
        toolbox: {
            feature: {
                saveAsImage: {}
            }
        },
        xAxis: {
            type: 'category',
            data:names
        },
        yAxis: {
            type: 'value'
        },
        series: [
            {
                name: '命中率',
                type: 'line',
                step: 'start',
                data: nums
            },
            {
                name: '三分命中率',
                type: 'line',
                step: 'middle',
                data: nums2
            }
            // },
            // {
            //     name: 'Step End',
            //     type: 'line',
            //     step: 'end',
            //     data: [450, 432, 401, 454, 590, 530, 510]
            // }
        ]
    })
})